from flask import Blueprint, render_template

from service.CommentService import get_comment_page, publish_comment, delete_comment

admin_comment = Blueprint('admin_comment', __name__)
admin_comment.url_prefix = '/admin'


@admin_comment.route("/comment_manage/<int:page>")
def get_comments(page):
    page = get_comment_page(page)
    return render_template('admin/comment-manage.html', page=page)


@admin_comment.route("/comment_delete/<string:uuid>/<int:page>")
def comment_delete(uuid, page):
    page = delete_comment(uuid, page)
    return render_template('admin/comment-manage.html', page=page)


@admin_comment.route("/comment_publish/<string:uuid>/<int:page>")
def comment_publish(uuid, page):
    page = publish_comment(uuid, page)
    return render_template('admin/comment-manage.html', page=page)
